Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[KDESKTOP-1262] Do not force file status after an upload session abortion #366

Draft
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

luc-guyot-infomaniak
Copy link
Contributor

@luc-guyot-infomaniak luc-guyot-infomaniak commented Oct 31, 2024

This pull request aims at addressing KDESKTOP-1262:

  • Reset the vfsForceStatus with nullptr after a drive upload session abortion.
  • For MacOSX only, reset the extended attribute of the local file that failed to be uploaded.

@luc-guyot-infomaniak luc-guyot-infomaniak force-pushed the kdesktop-1262-do-not-force-status-after-uploas-session-abortion branch from f22ce02 to e26d2fc Compare October 31, 2024 14:56
const SyncPath &localPath = getFilePath();
static const std::vector<const char *> extendedAttributes = {EXT_ATTR_STATUS, EXT_ATTR_PIN_STATE};

for (const auto attribute: extendedAttributes) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Questions.

  • Should we remove all attributes or just EXT_ATTR_STATUS? (What is the definition of a placeholder for the application?)
  • Is a missing permission an actual problem for the user?
  • In case of unexpected failure, should the exit code be changed?

Copy link
Contributor

@ClementKunz ClementKunz Dec 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we remove all attributes or just EXT_ATTR_STATUS? (What is the definition of a placeholder for the application?)

A file is a placeholder if it has the EXT_ATTR_STATUS extended attribute (see LiteSyncExtConnector::vfsGetStatus). So it should be enough to remove just this one. However, there is no point to keep only the pin state.
Moreover, the definition of a placeholder based solely on the status is also arguable. Perhaps basing it on the pinstate instead could help us display the correct status in Finder without risking to allow the deshydration of a not yet synced item.

Copy link
Contributor

@ClementKunz ClementKunz Dec 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is a missing permission an actual problem for the user?

Maybe. Perhaps we lose permissions during upload, which caused the abort. So the status has been set but cannot be removed, meaning that the file could be dehydrated while not synced, therefor corrupted.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case of unexpected failure, should the exit code be changed?

Maybe again ^^ but what can we do if the access rights have been removed 🥲

@luc-guyot-infomaniak luc-guyot-infomaniak marked this pull request as ready for review October 31, 2024 15:36
@luc-guyot-infomaniak luc-guyot-infomaniak requested a review from a team as a code owner October 31, 2024 15:36
@luc-guyot-infomaniak luc-guyot-infomaniak marked this pull request as draft October 31, 2024 15:38
@luc-guyot-infomaniak luc-guyot-infomaniak added 3.6.8 Review required but do not merge yet This PR is ready for review, however, it should not be merged before next release labels Nov 4, 2024
@luc-guyot-infomaniak luc-guyot-infomaniak added this to the 3.6.8 milestone Nov 22, 2024
@luc-guyot-infomaniak luc-guyot-infomaniak marked this pull request as ready for review November 22, 2024 09:52
@luc-guyot-infomaniak luc-guyot-infomaniak force-pushed the kdesktop-1262-do-not-force-status-after-uploas-session-abortion branch from 740245b to 87090d5 Compare November 22, 2024 09:57
Comment on lines +124 to +126
static const std::vector<const char *> extendedAttributes = {EXT_ATTR_STATUS, EXT_ATTR_PIN_STATE};

for (const auto attribute: extendedAttributes) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be in a utility function outside this class. Especially because normalupload (meaning direct uploads, not upload session) are also concerned.

@@ -16,8 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#import "../../../../src/libcommonserver/io/fileAttributes.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move the common declarations in vfs.h ?
Or create a new dynamic library "libcommonserverext" with the common code.

// by the application when restarting the synchronization.

const SyncPath &localPath = getFilePath();
static const std::vector<const char *> extendedAttributes = {EXT_ATTR_STATUS, EXT_ATTR_PIN_STATE};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the new function IoHelper::removeLiteSyncXAttrs

@ClementKunz ClementKunz removed the Review required but do not merge yet This PR is ready for review, however, it should not be merged before next release label Dec 6, 2024
@herve-er herve-er marked this pull request as draft December 9, 2024 09:11
@luc-guyot-infomaniak luc-guyot-infomaniak modified the milestones: 3.6.8, 3.6.9 Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants